﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BbsbWebService.Tasks;

namespace BbsbWebService.Repositories.Client
{
    public class ClientTaskRepository : RepositoryBase<BaseTask>
    {
        public override void SaveItem(BaseTask item)
        {
            ClientCommon.Service.SaveTask(item);
        }

        public override void RemoveItem(BaseTask item)
        {
            ClientCommon.Service.RemoveTask(item);
        }

        public override void Initialise()
        {
            var tasks = ClientCommon.Service.GetTasks();

            if (tasks != null)
            {
                foreach (var task in tasks)
                {
                    Items.Add(task);
                }
            }
        }
    }
}
